﻿using System;
using System.Collections.Generic;
using Eb;
using Es;

class EsEngineListener : IEsEngineListener
{
    //-------------------------------------------------------------------------
    public void init(EntityMgr entity_mgr, Entity et_node)
    {
        EbLog.Note("EsEngineListener.init()");

        entity_mgr.regComponentFactory(new ComponentFactory<ServerSampleUCenter<ComponentDef>>(entity_mgr));

        Entity et = entity_mgr.createEmptyEntity("EtSampleUCenter", null, et_node);
        et.addComponent<ServerSampleUCenter<ComponentDef>>();
    }

    //-------------------------------------------------------------------------
    public void release()
    {
        EbLog.Note("EsEngineListener.release()");
    }
}

class Program
{
    //-------------------------------------------------------------------------
    static void Main(string[] args)
    {
        Console.Title = "SampleUCenter";

        EsEngineSettings settings;
        settings.ProjectName = "SampleUCenter";
        settings.NodeType = 2;
        settings.NodeTypeString = "SampleUCenter";
        settings.NodeIp = "127.0.0.1";
        settings.NodePort = 5883;
        settings.EtNodeType = "EtNode";
        settings.EnableComponentSupersocket = true;
        settings.EsEngineExeConfigFilename = "../../../Media/SampleUCenter/EsEngine.dll.config";

        EsEngine e = new EsEngine(ref settings, new EsEngineListener());
        e.run();
    }
}
